<% if @remark.new_record? %>

cjs_replace('<%= "form_rnt_#{@remark.topic_id}" %>', 
  '<%=j render partial: "remarks/form", locals: { remark: @remark } %>');

<% elsif @remark.remark_type == 'confirm' %>

location.reload();

<% else %>

cjs_append('<%= "div_lrsht_#{@remark.topic_id}" %>',
  '<%=j render @remark %>');
cjs_replace('<%= "form_rnt_#{@remark.topic_id}" %>',
  '<%=j render partial: "remarks/form", locals: { remark: create_remark(@remark.topic) } %>');

<% end %>